/**
 * Bakalarska prace - Inteligentni budik
 * @package sleepCatcher
 * @file SCSleepView.h
 * @author Jan Pesava - xpesav00
 * @email xpesav00@stud.fit.vutbr.cz
 * @date 13. 3. 2012
 */

#ifndef SCSLEEPVIEW_H_
#define SCSLEEPVIEW_H_

#include <FBase.h>
#include <FMediaImage.h>
#include <FGraphics.h>
#include <FUi.h>

#include "models/SCSample.h"
#include "models/SCSession.h"

using namespace Osp::Base::Collection;
using namespace Osp::Media;
using namespace Osp::Graphics;
using namespace Osp::Ui::Controls;




class SCSleepView {
// Constructors
public:
	SCSleepView(Form* pCurrentForm, int x, int y, int width, int height, int countOfSamples, int simpleAvarage);
	SCSleepView(Form* pCurrentForm, int x, int y, int width, int height, SCSession* pSession);
	virtual ~SCSleepView();

// Constants

// Attributes
private:
	int x;
	int y;
	int height;
	int width;
	int countOfSamples;
	float maxY;
	float minY;
	int margin;
	Canvas* pSleepViewGraph;
	IList* pPoints;
	SCSession* pSession;
	int simpleAvarage;
	float energySum;
	Queue* pWindow;
	Queue* pWindowEnergy;
	Form* pCurrentForm;
	Bitmap* pBitmapBG;
	int i;

// Methods
public:
	void SetX(int value);
	int GetX();
	void SetY(int value);
	int GetY();
	void SetMinY(float value);
	int GetMinY();
	void SetMaxY(float value);
	int GetMaxY();
	void SetHeight(int value);
	int GetHeight();
	void SetWidth(int value);
	int GetWidth();
	void SetSession(SCSession* pSession);
	SCSession* GetSession();
	void SetCountOfSamples(int value);
	int GetCountOfSamples();
	void SetSleepViewGraph(Canvas* pCanvas);
	Canvas* GetSleepViewGraph();
	void AddSample(SCSample* pSample);
	Bitmap* CreatePicture();
	void SetDefaultValues();
	void InitSleepViewGraph();
	Osp::Base::Collection::IList* CreatePointListN(int width, int height);
	float ComputeWindowEnergy(SCSample* pAddedSample);
	void SetExtemes(Float* pLastEnergy);
	void StartCatch();
	void StopCatch();
	void Init();
	void Update();
	void Redraw();
};

#endif /* SCSLEEPVIEW_H_ */
